package org.xhs.geomap.net
{
	import com.mapabc.maps.api.basetypes.MLngLat;
	import com.mapabc.maps.api.basetypes.MLngLatBounds;
	import com.mapabc.maps.api.overlays.MPolygon;
	import com.mapabc.maps.api.overlays.options.MAreaOptions;
	import com.mapabc.maps.api.overlays.options.MLabelOptions;
	import com.mapabc.maps.api.styles.MFillStyle;
	import com.mapabc.maps.api.styles.MFontStyle;
	import com.mapabc.maps.api.styles.MLineStyle;

	public class BlockPolygon extends MPolygon
	{
		private var _centLnglat:MLngLat;
		private var _bounds:MLngLatBounds;
		private var _bcode:String;
		private var _bname:String;
		private var _bxfprice:Number;
		private var _besfprice:Number;
		private var _bzlprice:Number;
		private var areaopt:MAreaOptions=new MAreaOptions();
		
		public function BlockPolygon(lnglats:Array, centLnglat:MLngLat, bounds:MLngLatBounds, bcode:String, bname:String, xfprice:Number, esfprice:Number, zlprice:Number)
		{
			//设置区块标签
			var labelOptions:MLabelOptions = new MLabelOptions();
			var fontstyle:MFontStyle = new MFontStyle();
			fontstyle.color = 0xc02073;
			fontstyle.size = 18;
			fontstyle.name = "宋体";
			fontstyle.bold = true;
			labelOptions.fontStyle = fontstyle;
			labelOptions.content = bname;
			labelOptions.zoomLevels = [12,13,14,15,16,17];
			areaopt.labelOption = labelOptions;
			areaopt.zoomLevels = [3,4,5,6,7,8,9,10,11,12,13,14,15,16,17];			
			
			this.setDefaultOpt();
			super(lnglats, areaopt);
			_bounds = bounds;
			_bcode = bcode;
			_bname = bname;
			_centLnglat = centLnglat;
			_bxfprice = xfprice;
			_besfprice = esfprice;
			_bzlprice = zlprice;			
		}
		
		public function get bname():String
		{
			return _bname;
		}

		public function set bname(value:String):void
		{
			_bname = value;
		}

		public function get bcode():String
		{
			return _bcode;
		}

		public function set bcode(value:String):void
		{
			_bcode = value;
		}

		public function get bounds():MLngLatBounds
		{
			return _bounds;
		}

		public function set bounds(value:MLngLatBounds):void
		{
			_bounds = value;
		}

		public function get centLnglat():MLngLat
		{
			return _centLnglat;
		}

		public function set centLnglat(value:MLngLat):void
		{
			_centLnglat = value;
		}

		public function get bzlprice():Number
		{
			return _bzlprice;
		}

		public function set bzlprice(value:Number):void
		{
			_bzlprice = value;
		}

		public function get besfprice():Number
		{
			return _besfprice;
		}

		public function set besfprice(value:Number):void
		{
			_besfprice = value;
		}

		public function get bxfprice():Number
		{
			return _bxfprice;
		}

		public function set bxfprice(value:Number):void
		{
			_bxfprice = value;
		}

		public function setDefaultOpt():void
		{
			var mlstyle:MLineStyle = new MLineStyle();
			mlstyle.thickness = 0;
			mlstyle.color = 0xFFFFFF;
			areaopt.areaStyle.borderStyle = mlstyle;			
			
			var mfstyle:MFillStyle = new MFillStyle();
			mfstyle.color = 0xFFF886;
			mfstyle.alpha = 0.4;
			areaopt.areaStyle.fillStyle = mfstyle;	
		}
		
		public function setDefaultOptBig():void
		{
			var mlstyle:MLineStyle = new MLineStyle();
			mlstyle.thickness = 0;
			mlstyle.color = 0xFFFFFF;
			areaopt.areaStyle.borderStyle = mlstyle;			
			
			var mfstyle:MFillStyle = new MFillStyle();
			mfstyle.color = 0xFFF886;
			mfstyle.alpha = 0;
			areaopt.areaStyle.fillStyle = mfstyle;	
		}
		
		public function setFocusOpt():void
		{			
			var mlstyle:MLineStyle = new MLineStyle();
			mlstyle.thickness = 2;
			areaopt.areaStyle.borderStyle = mlstyle;
			
			var mfstyle:MFillStyle = new MFillStyle();
			mfstyle.color = 0xFFF886;
			mfstyle.alpha = 0.6;
			areaopt.areaStyle.fillStyle = mfstyle;			
		}
		
		public function setFocusOptBig():void
		{			
			var mlstyle:MLineStyle = new MLineStyle();
			mlstyle.thickness = 2;
			areaopt.areaStyle.borderStyle = mlstyle;
			
			var mfstyle:MFillStyle = new MFillStyle();
			mfstyle.color = 0xFFF886;
			mfstyle.alpha = 0;
			areaopt.areaStyle.fillStyle = mfstyle;			
		}
	}
}